<!--
 * @Author: g05047
 * @Date: 2022-02-18 11:01:22
 * @LastEditors: g05047
 * @LastEditTime: 2022-02-23 13:56:04
 * @Description: file content
-->
<template>
  <div class="single-page" v-if="unitInfo !== ''">
    <el-row>
      <h2>{{ unitInfo.unitname }}</h2>
      <el-tag>{{ unitInfo.districtName }}</el-tag>
      <el-tag type="success">{{ unitInfo.bodyindustry }}</el-tag>
      <el-tag type="warning" v-show="unitInfo.bodyindustryremarks !== ''">{{
        unitInfo.bodyindustryremarks
      }}</el-tag>
  <template v-if="unitInfo.categoryOne">
    <template v-if="unitInfo.categoryOne==unitInfo.categoryTwo">
        <el-tag >{{ unitInfo.categoryOne }}</el-tag>
  </template>
  <template v-else>
    <el-tag >{{ unitInfo.categoryOne }}</el-tag>
      <el-tag >{{ unitInfo.categoryTwo }}</el-tag>
  </template>
  </template>
 <el-tag v-if="unitInfo.tabelStatus=='正常'">接触进口冷链食品单位</el-tag>

  <!-- tabelStatus -->

   <template v-if="isButton">
        <el-button
        v-if="unitInfo.categoryOne"
        @click="$emit('edit')"
        icon="el-icon-edit"
        size="mini"
      ></el-button>
      <el-button
        v-else
        @click="$emit('edit')"
        icon="el-icon-plus"
        size="mini"
        >暂未设置标签</el-button
      >
   </template>

      <!-- labelDialog -->
    </el-row>
    <el-row style="margin-top: 15px" class="unit-info">
      <div style="margin-bottom: 10px">
        <span>统一社会信用代码：{{ unitInfo.identify }}</span>
        <span>许可证编号：{{ unitInfo.newlicenseno }}</span>
        <span>注册日期：{{ unitInfo.createdatetime }}</span>
      </div>
      <div>
        <span>经营地址：{{ unitInfo.address }}</span>
      </div>
    </el-row>
    <el-divider></el-divider>

    <el-tabs type="border-card">
      <el-tab-pane label="核酸采样记录">
        <!-- 采样查询条件 -->
        <el-row :gutter="10" style="margin-bottom: 10px">
          <el-col :span="25">
            <el-date-picker
              v-model="selectedDate"
              type="daterange"
              size="small"
              range-separator="—"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              value-format="yyyy-MM-dd"
              @change="handelChangeDate"
            >
            </el-date-picker>
          </el-col>
          <el-col :span="4">
            <el-select
              size="small"
              v-model="queryCollectionParam.status"
              placeholder="核酸采样填报"
              clearable
            >
              <el-option
                v-for="item in collectionOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-col>

          <el-col :span="4">
            <el-input
                  maxlength="50"
              size="small"
              v-model="queryCollectionParam.searchOne"
              placeholder="人员姓名/手机号码"
              clearable
            ></el-input>
          </el-col>
             <el-col :span="3">
        <el-select
          v-model="queryCollectionParam.samplingTypeStr"
          :clearable="false"
          size="small"
        >
          <el-option label="数据来源" value="0"></el-option>
          <el-option label="手工填报" value="1"></el-option>
          <el-option label="系统同步" value="2"></el-option>
        </el-select>
      </el-col>
          <el-col :span="5" class="btn">
            <el-button
              type="primary"
              size="small"
              @click="handleQueryCollection"
            >
              查询
            </el-button>
            <el-button
              size="small"
              @click="handelExportCollection"
              :loading="exportCollectionLoading"
            >
              导出
            </el-button>
          </el-col>
        </el-row>

        <!-- 采样表格数据 -->
        <el-table border stripe :data="collectionTableData" style="width: 100%">
          <el-table-column
            prop="planneddate"
            label="计划日期"
            align="center"
            width="120"
          >
          </el-table-column>
          
     <el-table-column
        prop="samplingType"
        label="数据来源"
        align="center"
        width="150px"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.samplingTypeStr == 2||scope.row.samplingTypeStr==3" class="green">
            {{ scope.row.samplingType }}
          </div>
          <div v-else-if="scope.row.actualdate == ''">--</div>
          <div v-else>{{ scope.row.samplingType }}</div>
        </template>
      </el-table-column>

          <el-table-column
            prop="actualdate"
            label="采样日期"
            align="center"
            width="170px"
          >
          </el-table-column>
          <el-table-column
            prop="samplingpoint"
            label="采样点"
            align="center"
            show-overflow-tooltip
            width="170px"
          >
            <template slot-scope="scope">
              <span>
                {{
                  scope.row.samplingpoint === ""
                    ? "--"
                    : scope.row.samplingpoint
                }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="thename"
            label="员工姓名"
            align="center"
            show-overflow-tooltip
          >
             <template slot-scope="scope">
          <span v-if="scope.row.plLabel">{{scope.row.thename}}({{scope.row.plLabel}})</span>
          <span v-else>{{scope.row.thename}}</span>
        </template>
          </el-table-column>
          <!-- <el-table-column
            prop="mobile"
            label="手机号码"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column> -->
          <!-- <el-table-column
            prop="streetName"
            label="采样区域街道"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column> -->
          <!-- <el-table-column
            prop="samplingpoint"
            label="采样点"
            align="center"
            show-overflow-tooltip
            width="150px"
          >
          </el-table-column> -->
          <el-table-column
            prop="status"
            label="核酸采样填报"
            align="center"
            show-overflow-tooltip
            width="110px"
          >
            <template slot-scope="scope">
              <span :class="scope.row.status === '如期采样' ? 'green' : 'red'">
                {{ scope.row.status }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="reasondelay"
            label="延期原因"
            align="center"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span>
                {{
                  scope.row.reasondelay === "" ? "--" : scope.row.reasondelay
                }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="informantTime"
            label="填报日期"
            align="center"
            show-overflow-tooltip
            width="170px"
          >
            <template slot-scope="scope">
              <span>
                {{
                  scope.row.informantTime === ""
                    ? "--"
                    : scope.row.informantTime
                }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="informant"
            label="填报者"
            align="center"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span>
                {{ scope.row.informant === "" ? "--" : scope.row.informant }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="smsReminderTotal"
            label="短信提醒"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column label="操作" align="center" width="80">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="handelViewCollection(scope.row)">
                查看
              </el-button>
            </template>
          </el-table-column>
        </el-table>

        <!-- 采样分页 -->
        <el-pagination
          style="float: right; margin-top: 20px"
          @current-change="changeCollectionCurrentPage"
          :page-size="queryCollectionParam.pageSize"
          background
          layout="total, prev, pager, next"
          :total="collectionListTotal"
          v-if="collectionListTotal > 0"
        >
        </el-pagination>
      </el-tab-pane>
      <el-tab-pane label="人员信息列表">
        <!-- 人员查询条件 -->
        <el-row :gutter="10" style="margin-bottom: 10px">
          <el-col :span="2">
            <el-select
              size="small"
              v-model="queryPersonParam.licensenumber"
              placeholder="健康码"
              clearable
            >
              <el-option
                v-for="item in healthyQROptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-col>
          <el-col :span="2">
            <el-select
              size="small"
              v-model="queryPersonParam.entrytime"
              placeholder="行程码"
              clearable
            >
              <el-option
                v-for="item in tripQROptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-col>
          <el-col :span="3">
            <el-select
              size="small"
              v-model="queryPersonParam.vaccination"
              placeholder="新冠疫苗接种"
              clearable
            >
              <el-option
                v-for="item in vaccinesOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-col>

     <el-col :span="2">
        <el-select
          v-model="queryPersonParam.personStatus"
          :clearable="false"
          size="small"
        >
          <el-option label="在岗" value="1"></el-option>
          <el-option label="离岗" value="2"></el-option>
        </el-select>
      </el-col>
          <el-col :span="2">
        <el-select
          v-model="queryPersonParam.plLabel"
          :clearable="false"
          size="small"
        >
          <el-option label="全部" value="0"></el-option>
          <el-option label="缓化" value="1"></el-option>
          <el-option label="非缓化" value="2"></el-option>
        </el-select>
      </el-col>

          <!-- <el-col :span="4">
            <el-select
              size="small"
              v-model="queryPersonParam.nucleicStatus"
              placeholder="核酸采样填报"
              clearable
            >
              <el-option
                v-for="item in collectionOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-col> -->
          <el-col :span="5">
            <el-input
                maxlength="50"
              size="small"
              v-model="queryPersonParam.searchOne"
              placeholder="人员姓名/手机号码"
              clearable
            ></el-input>
          </el-col>
          <el-col :span="5" class="btn">
            <el-button type="primary" size="small" @click="handleQueryPerson">
              查询
            </el-button>
            <el-button
              size="small"
              @click="handelExportPerson"
              :loading="exportPersonLoading"
            >
              导出
            </el-button>
          </el-col>
        </el-row>

        <!-- 人员表格数据 -->
        <el-table border stripe :data="personTableData" style="width: 100%">
          <el-table-column
            prop="thename"
            label="姓名"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            prop="mobile"
            label="手机号码"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            prop="licensenumber"
            label="健康码"
            align="center"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span
                :class="scope.row.licensenumber === '无异常' ? 'green' : 'red'"
                >{{ scope.row.licensenumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column
            prop="entrytime"
            label="行程码"
            align="center"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span
                :class="scope.row.entrytime === '无异常' ? 'green' : 'red'"
                >{{ scope.row.entrytime }}</span
              >
            </template>
          </el-table-column>
          <el-table-column
            prop="vaccination"
            label="新冠疫苗接种"
            align="center"
            show-overflow-tooltip
            width="220px"
          >
            <template slot-scope="scope">
              <span>
                {{ scope.row.vaccination }}({{ scope.row.vaccinationdate }})
              </span>
            </template>
          </el-table-column>
          <!-- <el-table-column
            prop="vaccinationdate"
            label="接种日期"
            align="center"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span>
                {{
                  scope.row.vaccinationdate === ""
                    ? "--"
                    : scope.row.vaccinationdate
                }}
              </span>
            </template>
          </el-table-column> -->
          <el-table-column
            prop="nucleicStatusDate"
            label="最新核酸采样情况"
            align="center"
            show-overflow-tooltip
            width="230px"
          >
            <template slot-scope="scope">
              <span>
              {{ scope.row.sampleCollectTime||'--' }}
              </span>
            </template>
          </el-table-column>

 <el-table-column
            prop="createTime"
            label="最新核酸报告情况"
            align="center"
            width="150"
          >

      <template slot-scope="scope">
        <div v-if="scope.row.result" class="green">
          {{scope.row.result}}({{scope.row.reportCollectTime}})
        </div>
        <div v-else>
          --
        </div>
      </template>
          </el-table-column>
          
          <el-table-column
            prop="createTime"
            label="添加日期"
            align="center"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column label="操作" align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-button size="mini" @click="handelViewPerson(scope.row)"
                >查看</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <!-- 人员分页 -->
        <el-pagination
          style="float: right; margin-top: 20px"
          @current-change="changePersonCurrentPage"
          :page-size="queryPersonParam.pageSize"
          background
          layout="total, prev, pager, next"
          :total="personListTotal"
          v-if="personListTotal > 0"
        >
        </el-pagination>
      </el-tab-pane>
    </el-tabs>

    <el-dialog
      width="50%"
      append-to-body
      :close-on-click-modal="false"
      :show-close="true"
      :destroy-on-close="true"
      :visible.sync="singleCollectionDialog"
    >
      <SingleCollectionInfo :personCollectionInfo="singeCollectionInfo" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="singleCollectionDialog = false"> 关 闭 </el-button>
      </span>
    </el-dialog>
    <el-dialog
      width="93%"
      append-to-body
      :close-on-click-modal="false"
      :show-close="true"
      :destroy-on-close="true"
      :visible.sync="singlePersonDialog"
    >
      <SinglePersonInfo
        ref="singlePersonInfoRef"
        :personInfo="singlePersonInfo"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="singlePersonDialog = false"> 关 闭 </el-button>
      </span>
    </el-dialog>

    <!-- <el-dialog
      title="编辑单位标签"
      width="30%"
      append-to-body
      :close-on-click-modal="false"
      :show-close="true"
      :destroy-on-close="true"
      :visible.sync="labelDialog"
    >
    <el-form ref="form" :model="form"  label-width="80px">
  <el-form-item label="单位标签">
<el-cascader
        clearable
        placeholder="请选择单位标签"
        size="small"
        v-model="query.categoryStr"
        :options="bodyindustryList"
        @change="onCascaderChange"
      ></el-cascader>
  </el-form-item>
    <el-form-item label="冷链单位">
          <el-checkbox v-model="query.status" true-label="0" false-label="1">接触进口冷链食品单位</el-checkbox>
    </el-form-item>
    </el-form>
      
      <span slot="footer" class="dialog-footer">
        <el-button @click="labelDialog=false"> 关 闭 </el-button>
        <el-button  @click="determine" type="primary"> 确 定</el-button>
      </span>
    </el-dialog> -->
  </div>
</template>

<script>
import SingleCollectionInfo from "@/views/coldLink/collectionInfo/singleCollectionInfo.vue";
import SinglePersonInfo from "@/views/coldLink/personInfo/singlePersonInfo.vue";
export default {
  components: {
    SingleCollectionInfo,
    SinglePersonInfo,
  },
  props: {
    unitInfo: {
      Type: Object,
    },
  isButton: {
      type: Boolean,
      default:true,
    },
    
  },
  data() {
    return {
       form: {},
      labelDialog: false,
      query: {
        unitId: "",
        unitName: "",
        categoryOne: "",
        categoryTwo: "",
        categoryStr: "",
        status:"0"
      },
      // unitInfo: "", //单位信息
      collectionOptions: [
        { label: "如期填报", value: 1 },
        { label: "延期补录", value: 2 },
        { label: "延期异常", value: 0 },
      ], //核酸采样状态

      queryCollectionParam: {
        // areaCode: "", //区域编码
        // bodyindustry: "", //主体业态
        endDateCompletion: "", //结束时间(采样时间)
        startDateCompletion: "", //开始时间(采样时间)
        pageIndex: 1, //开始页码
        pageSize: 10, //每页记录条数
        searchOne: "", //搜索(人员姓名/手机号码)
        // searchTwo: "", //搜索(单位名称/社会信用代码)
        status: "", //核酸采样填报 采样状态 0 未采样1如期采样 2延期补录 默认-1 0延期异常
        samplingTypeStr:"0"
      }, //采样记录列表查询参数

      selectedDate: "", //采样列表查询日期
      exportCollectionLoading: false, //采样导出loading
      collectionTableData: [], //采样列表
      collectionListTotal: 0, //采样列表总条数

      queryPersonParam: {
        personStatus:"1",
        // areaCode:"",//区域编码
        // bodyindustry:"",//主体业态
        entrytime: "", //行程码 0异常 1无异常
        licensenumber: "", //健康码 0异常 1无异常
        nucleicStatus: "", //采样状态 0 未采样1如期采样 2延期补录 默认-1 0延期异常
        pageIndex: 1, //开始页码
        pageSize: 10, //每页记录条数
        searchOne: "", //搜索(人员姓名/手机号码)
        // searchTwo: "", //搜索(单位名称/社会信用代码)
        vaccination: "", //新冠疫苗接种 0未接种 1第一针 2第二针 3第三针
        plLabel:"0"
      }, //人员信息列表查询参数

      healthyQROptions: [
        {
          label: "异常",
          value: 0,
        },
        {
          label: "无异常",
          value: 1,
        },
      ], //健康码状态

      tripQROptions: [
        {
          label: "异常",
          value: 0,
        },
        {
          label: "无异常",
          value: 1,
        },
      ], //行程码状态

      vaccinesOptions: [
        { label: "已接种第三针", value: 3 },
        { label: "已接种第二针", value: 2 },
        { label: "已接种第一针", value: 1 },
        { label: "未接种", value: 0 },
      ], //疫苗接种状态

      exportPersonLoading: false, //人员导出loading
      personTableData: [], //人员列表
      personListTotal: 0, //人员列表总条数

      singleCollectionDialog: false, //单个采集弹窗
      singeCollectionInfo: {}, //单个采集信息
      singlePersonDialog: false, //单个人员弹窗
      singlePersonInfo: {}, ///单个人员信息
      bodyindustryList: [
        {
          value: "食品生产单位",
          label: "食品生产单位",
        },
        {
          value: "食品经营单位",
          label: "食品经营单位",
          children: [
            {
              value: "餐饮服务经营者",
              label: "餐饮服务经营者",
            },
            {
              value: "食品销售经营者",
              label: "食品销售经营者",
            },
            {
              value: "单位食堂",
              label: "单位食堂",
            },
          ],
        },
        {
          value: "第三方冷库",
          label: "第三方冷库",
        },
        {
          value: "集中监管单位",
          label: "集中监管单位",
          children: [
            {
              value: "集中监管仓",
              label: "集中监管仓",
            },
            {
              value: "白名单企业",
              label: "白名单企业",
            },
          ],
        },
      ],
    };
  },
  created() {
    // console.log(this.$route);
    // if (this.$route.params.unitInfo) {
    //   sessionStorage.setItem(
    //     "UNIT_INFO",
    //     JSON.stringify(this.$route.params.unitInfo)
    //   );
    // }
    // this.unitInfo = JSON.parse(sessionStorage.getItem("UNIT_INFO"));

    this.selectedDate = [
      this.$moment().subtract(6, "days").format("YYYY-MM-DD"),
      this.$moment().format("YYYY-MM-DD"),
    ];
    this.queryCollectionParam.startDateCompletion = this.selectedDate[0];
    this.queryCollectionParam.endDateCompletion = this.selectedDate[1];
    if( this.unitInfo.categoryOne){
        this.query.categoryOne=this.unitInfo.categoryOne
    if(this.unitInfo.categoryTwo){
        this.query.categoryTwo=this.unitInfo.categoryTwo
    }
        if(this.unitInfo.categoryOne==this.unitInfo.categoryTwo){
            this.query.categoryStr=[this.unitInfo.categoryOne]
        }else{
        this.query.categoryStr=[this.unitInfo.categoryOne,this.unitInfo.categoryTwo]

        } 

        
    }

    
    if(this.unitInfo.tabelStatus=='正常'||this.unitInfo.tabelStatus==''){
      this.query.status="0"
    }else{
        this.query.status="1"
    }
    this.query.unitId = this.unitInfo.id;
    this.query.unitName = this.unitInfo.unitname;

    // query: {
    //       unitId: "",
    //       unitName: "",
    //       categoryOne: "",
    //       categoryTwo: "",
    //       categoryStr:""
    //     },

    // this.queryCollectionParam.id = this.queryPersonParam.id =
    //   this.unitInfo.id;

    // this.getCollectionList();
    // this.getPersonList();
  },

  methods: {
    //选择时间
    handelChangeDate() {
      console.log(this.selectedDate);
      this.queryCollectionParam.startDateCompletion = this.selectedDate[0];
      this.queryCollectionParam.endDateCompletion = this.selectedDate[1];
    },

    //查询采样列表
    handleQueryCollection() {
      this.getCollectionList();
    },

    //导出采样列表
    handelExportCollection() {
      this.exportCollectionLoading = true;

      this.queryCollectionParam.id = this.unitInfo.id;

      let params = JSON.parse(JSON.stringify(this.queryCollectionParam));
      if (params.status === "") {
        params.status = -1;
      }

      this.$http.exportCollectionList(params).then((res) => {
        var blob = new Blob([res], {
          type: "application/vnd.ms-excel;charset=utf-8",
        });
        var downloadElement = document.createElement("a");
        var href = window.URL.createObjectURL(blob); //创建下载的链接
        downloadElement.href = href;
        downloadElement.download =
          this.unitInfo.unitname +
          "_核酸采样记录_" +
          new Date().getTime() +
          ".xlsx"; //下载后文件名
        document.body.appendChild(downloadElement);
        downloadElement.click(); //点击下载
        document.body.removeChild(downloadElement); //下载完成移除元素
        window.URL.revokeObjectURL(href); //释放掉blob对象

        this.exportCollectionLoading = false;
      });
    },

    //查看采样详细
    handelViewCollection(row) {
      console.log(row);

      this.singeCollectionInfo = row;
      this.singleCollectionDialog = true;
    },

    //采样分页
    changeCollectionCurrentPage(val) {
      // console.log("分页", val);
      this.queryCollectionParam.pageIndex = val;
      this.getCollectionList();
    },

    //查询人员列表
    handleQueryPerson() {
      this.getPersonList();
    },

    //导出人员列表
    handelExportPerson() {
      this.exportPersonLoading = true;
  
      this.queryPersonParam.id = this.unitInfo.id;
      let params = JSON.parse(JSON.stringify(this.queryPersonParam));
      if (params.entrytime === "") {
        params.entrytime = -1;
      }
      if (params.licensenumber === "") {
        params.licensenumber = -1;
      }
      if (params.nucleicStatus === "") {
        params.nucleicStatus = -1;
      }
      if (params.vaccination === "") {
        params.vaccination = -1;
      }

      this.$http.exportPersonList(params).then((res) => {
        var blob = new Blob([res], {
          type: "application/vnd.ms-excel;charset=utf-8",
        });
        var downloadElement = document.createElement("a");
        var href = window.URL.createObjectURL(blob); //创建下载的链接
        downloadElement.href = href;
        downloadElement.download =
          this.unitInfo.unitname +
          "_人员信息列表录_" +
          new Date().getTime() +
          ".xlsx"; //下载后文件名
        document.body.appendChild(downloadElement);
        downloadElement.click(); //点击下载
        document.body.removeChild(downloadElement); //下载完成移除元素
        window.URL.revokeObjectURL(href); //释放掉blob对象

        this.exportPersonLoading = false;
      });
    },

    //查看人员详细
    handelViewPerson(row) {
      console.log("查看", row);

      this.singlePersonInfo = row;
      this.singlePersonDialog = true;

      this.$nextTick(function () {
        // 仅在整个视图都被重新渲染之后才会运行的代码;
        this.$refs.singlePersonInfoRef.getCollectionList();
      });

      // setTimeout(() => {
      //   this.$refs.singlePersonInfoRef.getCollectionList();
      // }, 100);
    },

    //人员分页
    changePersonCurrentPage(val) {
      this.queryPersonParam.pageIndex = val;
      this.getPersonList();
    },

    //获取采样列表
    getCollectionList() {
      this.queryCollectionParam.id = this.unitInfo.id;

      console.log("采样请求参数", this.queryCollectionParam);

      let params = JSON.parse(JSON.stringify(this.queryCollectionParam));

      if (params.status === "") {
        params.status = -1;
      }

      this.$http.getCollectionList(params).then((res) => {
        console.log("采样列表请求", res);
        const { code, data, msg } = res;
        if (code === 200) {
          this.collectionTableData = data.list;
          this.collectionListTotal = data.total;
        } else {
          this.$message.error(msg);
        }
      });
    },

    //获取人员列表
    getPersonList() {
      this.queryPersonParam.id = this.unitInfo.id;

      console.log("人员列表请求参数", this.queryPersonParam);

      let params = JSON.parse(JSON.stringify(this.queryPersonParam));
      if (params.entrytime === "") {
        params.entrytime = -1;
      }
      if (params.licensenumber === "") {
        params.licensenumber = -1;
      }
      if (params.nucleicStatus === "") {
        params.nucleicStatus = -1;
      }
      if (params.vaccination === "") {
        params.vaccination = -1;
      }

      this.$http.getPersonList(params).then((res) => {
        console.log("人员列表请求", res);
        const { code, data, msg } = res;
        if (code === 200) {
          this.personTableData = data.list;
          this.personListTotal = data.total;
        } else {
          this.$message.error(msg);
        }
      });
    },
    onCascaderChange(e) {
      if (e.length == 2) {
        this.query.categoryOne = e[0];
        this.query.categoryTwo = e[1];
      } else if (e.length == 1) {
        this.query.categoryOne = e[0];
        this.query.categoryTwo =e[0];
      } else {
        this.query.categoryOne = "";
        this.query.categoryTwo = "";
        this.query.categoryStr = "";
      }
    },
    determine(){
      if(this.query.categoryStr==''){
        return this.$error('请选择单位标签')
      }


   this.$http.saveunitColdChainLabel(this.query).then((res) => {
             this.labelDialog=false
            //  this.singleUnitInfoDialogVisible=false;
             this.$emit("closeDialog")
      });
  


      // console.log(343);
    }
  },
};
</script>

<style lang="less" scoped>
.single-page {
  // padding: 10px 20px;
  .unit-info {
    span {
      margin-right: 30px;
    }
  }
  // .btn {
  //   display: flex;
  //   justify-content: flex-end;
  // }
  .red {
    color: red;
  }
  .green {
    color: green;
  }
  .el-tag {
    margin-right: 10px;
  }
}
</style>
